package com.lsu.app.mapper;

import com.lsu.app.bean.Kind;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Set;

/**
 *
 * @description 针对表【kind(课程类型表)】的数据库操作Mapper
 * @Date 2023-11-03 12:52:08
 * @author hjj
 */
@Mapper
public interface KindMapper extends BaseMapper<Kind> {
    @Select("select kv_value from kind where course_id = #{courseId}")
    List<String> getValueByCourseId(Integer courseId);//查询该课程下的所有类型标签
    @Select("select `name` from kv_code where type=3 and value>0")
    List<String> getAllKindValue();//获取所有kind类型名称
    @Select("select course_id from kind where kv_value = #{kindName}")
    List<Integer> getCourseIdsByKindName(String kindName);//根据类型名称获取课程id集合
    @Select("select kv_value_id from kind where course_id = #{id}")
    List<Integer> getKindIdsByCourseId(Integer id);//获取课程id下的所有类型id

    @Insert("insert into taste_kind values (null,#{tasteId},#{kindId})")
    void insertTasteKind(@Param("tasteId") Integer tasteId,@Param("kindId") Integer kindId);//插入关联表

    @Insert("insert into kv_code values (null,#{type},#{value},#{name},now())")
    void insertBatchByALL(@Param("type") Integer type,@Param("value") Integer value,@Param("name") String name);
}




